Don't segfault if gcc expects -nopie instead of -no-pie
authorRob Browning <rlb@defaultvalue.org>
Mon, 24 Oct 2016 18:05:01 +0000 (13:05 -0500)
committerRob Browning <rlb@defaultvalue.org>
Mon, 24 Oct 2016 18:05:16 +0000 (13:05 -0500)
Thanks to Lucas Nussbaum and Aaron M. Ucko for reporting the problem,
and Sven Joachim for tracking down the upstream patch.

Closes: 841551
1  2 
debian/.git-dpm
debian/patches/0008-Emacs-shouldn-t-segfault-when-gcc-expects-nopie.patch
debian/patches/series

diff --cc debian/.git-dpm
index 1fde73f442201c108abe03face2ff318d16fc64e,0000000000000000000000000000000000000000..33bdee1e6610c504eae3aa07ff89698cc3a7d94f
mode 100644,000000..100644
--- /dev/null
@@@ -1,8 -1,0 +1,8 @@@
- c7e8cdc2eee113bf6d49f25c1ef6d9ef02f8f94b
- c7e8cdc2eee113bf6d49f25c1ef6d9ef02f8f94b
 +# see git-dpm(1) from git-dpm package
++f3fed65c40d2a1e32794cfc3b2c077f2eea52d5c
++f3fed65c40d2a1e32794cfc3b2c077f2eea52d5c
 +d3e6b8a251634ad673242aaa4a298edbb2e8ee39
 +d3e6b8a251634ad673242aaa4a298edbb2e8ee39
 +emacs25_25.1+1.orig.tar.xz
 +e5357a302a9609e2efc2c942b03b9110245280bd
 +23167732
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..f5b6bc3d27b51b9567c5efb12f143623344f2048
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,68 @@@
++From f3fed65c40d2a1e32794cfc3b2c077f2eea52d5c Mon Sep 17 00:00:00 2001
++From: Paul Eggert <eggert@cs.ucla.edu>
++Date: Sun, 16 Oct 2016 16:25:47 -0700
++Subject: Emacs shouldn't segfault when gcc expects -nopie
++
++This upstream patch has been added:
++
++  Port to Ubuntu 16.10, which needs gcc -nopie
++
++  * configure.ac (emacs_cv_prog_cc_no_pie): Rename from
++  emacs_cv_prog_cc_nopie.  All usages changed.  Check for -no-pie in
++  preference to -nopie (Bug#24682).  Backport from master.
++
++Origin: upstream, commit: 99892eeec8990884ef38601f14038ec6dc227741
++Bug: https://debbugs.gnu.org/24682
++Bug-Debian: https://bugs.debian.org/841551
++---
++ configure.ac | 32 ++++++++++++++++++--------------
++ 1 file changed, 18 insertions(+), 14 deletions(-)
++
++diff --git a/configure.ac b/configure.ac
++index eeaa79d..95502ee 100644
++--- a/configure.ac
+++++ b/configure.ac
++@@ -5159,25 +5159,29 @@ case "$opsys" in
++   *) LD_SWITCH_SYSTEM_TEMACS= ;;
++ esac
++ 
++-# -nopie fixes a temacs segfault on Gentoo, OpenBSD, and other systems
++-# with "hardened" GCC configurations for some reason (Bug#18784).
++-# We don't know why -nopie works, but not segfaulting is better than
++-# segfaulting.  Use ac_c_werror_flag=yes when trying -nopie, otherwise
++-# clang keeps warning that it does not understand -nopie, and pre-4.6
++-# GCC has a similar problem (Bug#20338).
++-AC_CACHE_CHECK([whether $CC accepts -nopie],
++-  [emacs_cv_prog_cc_nopie],
+++# -no-pie or -nopie fixes a temacs segfault on Gentoo, OpenBSD,
+++# Ubuntu, and other systems with "hardened" GCC configurations for
+++# some reason (Bug#18784).  We don't know why this works, but not
+++# segfaulting is better than segfaulting.  Use ac_c_werror_flag=yes
+++# when trying the option, otherwise clang keeps warning that it does
+++# not understand it, and pre-4.6 GCC has a similar problem
+++# (Bug#20338).  Prefer -no-pie to -nopie, as -no-pie is the
+++# spelling used by GCC 6.1.0 and later (Bug#24682).
+++AC_CACHE_CHECK(
+++  [for $CC option to disable position independent executables],
+++  [emacs_cv_prog_cc_no_pie],
++   [emacs_save_c_werror_flag=$ac_c_werror_flag
++    emacs_save_LDFLAGS=$LDFLAGS
++    ac_c_werror_flag=yes
++-   LDFLAGS="$LDFLAGS -nopie"
++-   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
++-     [emacs_cv_prog_cc_nopie=yes],
++-     [emacs_cv_prog_cc_nopie=no])
+++   for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do
+++     test $emacs_cv_prog_cc_no_pie = no && break
+++     LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie"
+++     AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break])
+++   done
++    ac_c_werror_flag=$emacs_save_c_werror_flag
++    LDFLAGS=$emacs_save_LDFLAGS])
++-if test "$emacs_cv_prog_cc_nopie" = yes; then
++-  LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -nopie"
+++if test "$emacs_cv_prog_cc_no_pie" != no; then
+++  LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie"
++ fi
++ 
++ if test x$ac_enable_profiling != x ; then
index 55e1080ea8ceca6eb929b49a7ffa1ce5d0411a1e,0000000000000000000000000000000000000000..20a263f964d1c7cad6311483059eccaf359d2861
mode 100644,000000..100644
--- /dev/null
@@@ -1,7 -1,0 +1,8 @@@
 +0001-Prefer-usr-share-info-emacs-MAJORVERSION.patch
 +0002-Run-debian-startup-and-set-debian-emacs-flavor.patch
 +0003-Remove-files-that-appear-to-be-incompatible-with-the.patch
 +0004-Adjust-documentation-references-for-Debian.patch
 +0005-Modify-the-output-of-version-to-indicate-Debian-modi.patch
 +0006-Don-t-try-to-build-src-macuvs.h-via-IVD_Sequences.tx.patch
 +0007-Kill-gpg-agent-in-package-test.el-to-avoid-a-race.patch
++0008-Emacs-shouldn-t-segfault-when-gcc-expects-nopie.patch